//
//  HSLotteryAwardCell.m
//  HolyShit
//
//  Created by Robin on 2017/4/29.
//  Copyright © 2017年 HolyShit. All rights reserved.
//

#import "HSLotteryAwardCell.h"

@interface HSLotteryAwardCell ()

@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *moneyLb;
@property (nonatomic, strong) UILabel *timeLb;
@property (nonatomic, strong) UILabel *contentLb;

@end

@implementation HSLotteryAwardCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self commonInit];
    }
    return self;
}

- (void)commonInit
{
    self.backgroundColor = HEXCOLOR(HSColorBgLight);
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.bgView = [UIView new];
    self.bgView.backgroundColor = WHITE_COLOR;
    [self addSubview:self.bgView];
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(0);
        make.bottom.mas_equalTo(-10);
    }];
    
    UIView *line = [UIView new];
    line.backgroundColor = HEXCOLOR(HSColorSeparateLight);
    [self.bgView addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(ScreenWidth * 0.28);
        make.top.mas_equalTo(15);
        make.bottom.mas_equalTo(-15);
        make.width.mas_equalTo(1);
    }];
    
    self.moneyLb = [UILabel labelWithFont:MYBoldFont(28) color:HEXCOLOR(HSColorRed)];
    self.moneyLb.textAlignment = NSTextAlignmentCenter;
    [self.bgView addSubview:self.moneyLb];
    [self.moneyLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.equalTo(line.mas_left);
        make.top.mas_equalTo(20);
    }];
    
    self.timeLb = [UILabel labelWithFont:MYFont(Font24) color:HEXCOLOR(HSColorBlack)];
    self.timeLb.textAlignment = NSTextAlignmentCenter;
    [self.bgView addSubview:self.timeLb];
    [self.timeLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.moneyLb);
        make.bottom.mas_equalTo(-10);
    }];
    
    self.contentLb = [UILabel labelWithFont:MYFont(Font24) color:HEXCOLOR(HSColorBlack)];
    self.contentLb.numberOfLines = 0;
    [self.bgView addSubview:self.contentLb];
    [self.contentLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(line.mas_right).offset(10);
        make.top.equalTo(line);
        make.right.mas_equalTo(-15);
    }];
    
    UILabel *temLb = [UILabel labelWithFrame:CGRectZero font:MYFont(Font24) color:HEXCOLOR(HSColorBlue) text:@"查看详情>>"];
    [self.bgView addSubview:temLb];
    [temLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.bottom.mas_equalTo(-8);
    }];
}

- (void)setModel:(HSLotteryAwardModel *)model
{
    _model = model;
    self.moneyLb.text = model.money;
    if (model.w_expert.length > 0) {
        self.timeLb.text = [NSString stringWithFormat:@"双色球%@期", model.w_expert];
    }
    else{
        self.timeLb.text = @"竞猜足彩";
    }
    self.contentLb.text = model.w_title_template;
}


@end
